package com.ruan.common;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@Data
public class Result<T> implements Serializable {//R这个对象需要序列化，否则无法缓存@Cacheable
    private Integer code;
    private Object data;//数据
    private String msg;//错误信息
    private Map map = new HashMap(); //动态数据

    public Result(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(Integer code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

}
